const axios = require('axios');
module.exports = {
    //填写你的测试号密钥
    appid: 'wxf11506255328bb18 ',//'wx238f435c5c632f8a',//'wxe011a99cd1a3511a',
    secret: '6d99b10aa45d2d06e444437ed36a43b8',//'50f55c012576b56be13a71be3f5c5f2c', //'f53f6b6d57a23c00537864b0a2ac1f1c',
    // 通过code获取openid
    get_openid(code){
        return new Promise((resolve, reject) => {
            axios({
                url: 'https://api.weixin.qq.com/sns/jscode2session',
                method: 'get', // 默认值
                params: {
                    appid: 'wxf11506255328bb18',
                    secret: '6d99b10aa45d2d06e444437ed36a43b8',
                    js_code: code,
                    grant_type: 'authorization_code'
                },

            }).then(function (response) {
                console.log(11111111);
                console.log(response.data);
                resolve(response.data);  
              }).catch(error => {
                reject(error); // 处理错误情况
            });
              
        })
    }
};
